/**********************************************************
 * SessionUtil.java
 * Created by ankur
 * Last modified Date: Aug 9, 2008 3:19:13 PM by ankur
 * Version : 0.1
 * Copyright (c) 2008 - 2008 cyberThink Infotech Pvt. Ltd., All rights reserved.
 **********************************************************/

package com.printeverywhere.util;

import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import com.printeverywhere.dto.User;

/**
 * The Class SessionUtil.
 */
public class SessionUtil {
	
	/** Logger for this class. */
	private static final Logger logger = Logger.getLogger(SessionUtil.class);
	
	/**
	 * Gets the user.
	 * 
	 * @param request the request
	 * 
	 * @return the user
	 */
	public static User getUser(HttpServletRequest request){
		if (logger.isDebugEnabled()) {
			logger.debug("getUser(HttpServletRequest) - start"); //$NON-NLS-1$
		}

		User returnUser = (User) request.getSession().getAttribute(AttributeConstants.USER);
		if (logger.isDebugEnabled()) {
			logger.debug("getUser(HttpServletRequest) - end"); //$NON-NLS-1$
		}
		return returnUser;
	}
}